package com.webdev.service.imp;

import com.webdev.dao.PersonnelDao;
import com.webdev.dao.imp.PersonnelDaoImp;
import com.webdev.domain.Personnel;
import com.webdev.service.PersonnelService;

import net.sf.json.JSONObject;

public class PersonnelServiceImp implements PersonnelService {

	@Override
	public boolean logIn(String username, String password) {
		PersonnelDao dao = new PersonnelDaoImp();
		return dao.logIn(username, password);
	}

	@Override
	public Personnel getPersonnelByUsername(String username) {
		PersonnelDao dao = new PersonnelDaoImp();
		return dao.getPersonnelByUsername(username);
	}

	@Override
	public JSONObject getJSONObject(Personnel personnel) {
		JSONObject jo = new JSONObject();
		jo.put("pid", personnel.getPid());
		jo.put("pname", personnel.getPname());
		jo.put("username", personnel.getUsername());
		jo.put("password", personnel.getPassword());
		jo.put("pidentity", personnel.getPidentity());
		return jo;
	}

	@Override
	public Personnel getPersonnelById(int id) {
		PersonnelDao dao = new PersonnelDaoImp();
		return dao.getPersonnelById(id);
	}

}
